package com.wwj.core.app.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wwj.core.app.entity.AppAdvice;
import com.wwj.core.app.entity.mapper.AppAdviceMapper;
import com.wwj.core.app.service.IAppAdviceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;

/**
 * Created by xya on 16-10-24.
 */
@Service
public class AppAdviceServiceImpl implements IAppAdviceService {

    @Resource
    private AppAdviceMapper appAdviceMapper;

    @Override
    public Page<AppAdvice> findByPage(int offset, int limit, Map<String, Object> params) {
        PageHelper.offsetPage(offset, limit);
        return (Page<AppAdvice>) appAdviceMapper.selectAppAdvices(params);
    }

    @Override
    public void addAppAdvice(AppAdvice appAdvice) {
        appAdvice.setCreateTime(new Date());
        appAdviceMapper.insertAppAdvice(appAdvice);
    }
}
